<script type="text/javascript">
	
function FindSubArr(arr, target) {
	let l = 0, r = -1;
	let sum = 0;
	let res = [];
	// debugger
	while(r<arr.length) {
		if(sum < target) {
			sum += arr[++r];
		} else {
			res.push([l,r]);
			sum -= arr[l++]
		}
	}

	return res;
}

const res = FindSubArr([6], 6)
console.log(res)

</script>